<template>
	<view class="gufen">
		<view class="headbox">
			<image src="@/static/images/jtb.png" mode="aspectFit"></image>
			<view class="row">我的股份</view>
			<view class="row2">
				<text>{{ info.stock || 0 }}</text>
				<text>股</text>
			</view>
		</view>
		<view class="container">
			<j-yongJinList gf :list="list"></j-yongJinList>
			<u-loadmore :status="status" />
		</view>

		<footer-btn
			text="原始股东"
			:btnStyle="{
				color: '#000',
				background: 'linear-gradient(135deg, #ffe9cc 0%, #f2cea1 100%)'
			}"
			@submit="toNav(`gufen/ysgudong`)"
		></footer-btn>
	</view>
</template>

<script>
export default {
	name: 'gufen',
	data() {
		return {
			status: '',
			info: {},
			list: [],
			paging: {
				page: 1,
				pagenum: 10
			},
			type: -1
		};
	},
	onLoad() {
		this.reset();
		this.init();
	},
	onReachBottom() {
		if (this.status === 'nomore') return;
		this.init();
	},
	methods: {
		reset(){
			this.paging.page = 1;
			this.list = [];
		},
		init() {
			this.$http.getJson('users_stockRecord', { type: this.type, ...this.paging }).then((res) => {
				const { code, data, message } = res;
				this.info = res;
				if (code === 1) {
					if (data.length !== 0) this.list = this.list.concat(data);
					if (this.paging.pagenum === data.length) {
						this.paging.page += 1;
						this.status = 'loadmore';
					} else {
						this.status = 'nomore';
					}
					console.log('users_stockRecord', data);
				}
			});
		}
	}
};
</script>

<style lang="less" scoped>
.gufen {
	.container {
		padding: 24rpx 32rpx;
	}
	.headbox {
		position: relative;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		width: 750rpx;
		height: 160rpx;
		padding: 26rpx 32rpx 16rpx;
		background: linear-gradient(135deg, #ffe9cc 0%, #f2cea1 100%);
		& > image {
			.fix-c-y();
			right: 0;
			width: 220rpx;
			height: 220rpx;
		}
		.row {
			font-size: 24rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #53361e;
		}
		.row2 {
			text:nth-of-type(1) {
				font-size: 56rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #53361e;
				margin-right: 8rpx;
			}
			text:nth-of-type(2) {
				font-size: 24rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #53361e;
			}
		}
	}
}
</style>
